package com.mes.service.zc;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.mes.dao.zc.ZcBomMapper;
import com.mes.entity.cb.Materiel;
import com.mes.entity.hy.Product;
import com.mes.entity.lz.ProductUnionMaterial;
import com.mes.entity.lz.QYT_MaterielPage;
import com.mes.entity.lz.QYT_ProductPage;
import com.mes.entity.yzl.Condition;
import com.mes.entity.zc.MaterNum;
/**
 * 
 * @ClassName: ZcBomServiceImpl 
 * @Description:
 * @Author zc
 * @Date 2018年3月30日 上午9:53:44 
 * @version 1.0
 */
@Service
@Transactional
public class ZcBomServiceImpl implements ZcBomService {
	@Resource
	ZcBomMapper bomMapper;
	
	/*查询数据库中的所有产品实体*/
	@Override
	public List<Product> pageQueryProductAll(QYT_ProductPage qyt_ProductPage) {
		return bomMapper.pageQueryProductAll(qyt_ProductPage);
	}

	/*查询数据库中所有物料实体*/
	@Override
	public List<Materiel> pageQueryMaterieAll(QYT_MaterielPage qyt_MaterielPage) {
		return bomMapper.pageQueryMaterieAll(qyt_MaterielPage);
	}

	/*保存前先查询数据库该信息是否存在*/
	@Override
	public List<ProductUnionMaterial> queryPUMExist(String pNum) {
		return bomMapper.queryPUMExist(pNum);
	}

	/*查询到数据后先清空，再写入*/
	@Override
	public void queryPUMAndSetNull(String pNum) {
		bomMapper.queryPUMAndSetNull(pNum);
	}
	
	/*如果存在就修改*/
	@Override
	public void receive2TabAndUpdate(ProductUnionMaterial productUnionMaterial) {
		bomMapper.receive2TabAndUpdate(productUnionMaterial);
	}

	/*不存在就添加*/
	@Override
	public void receive2TabAndSave(ProductUnionMaterial productUnionMaterial) {
		bomMapper.receive2TabAndSave(productUnionMaterial);
	}

	/*查询数据库中的所有产品实体数量*/
	@Override
	public int pageQueryProductAllCount(QYT_ProductPage qyt_ProductPage) {
		return bomMapper.pageQueryProductAllCount(qyt_ProductPage);
	}

	/*查询数据库中的所有物料实体数量*/
	@Override
	public int pageQueryMaterieAllCount(QYT_MaterielPage qyt_MaterielPage) {
		return bomMapper.pageQueryMaterieAllCount(qyt_MaterielPage);
	}

	@Override
	public void insertMaterNum(MaterNum materNum) {
		bomMapper.insertMaterNum(materNum);
		
	}

	@Override
	public void updateProduct(String num) {
		// TODO Auto-generated method stub
		bomMapper.updateProduct(num);
	}

	@Override
	public int findQueryMaterieXQCount(Condition condition) {
		// TODO Auto-generated method stub
		return bomMapper.findQueryMaterieXQCount(condition);
	}

	@Override
	public List<Materiel> findQueryMaterieXQ(Condition condition) {
		// TODO Auto-generated method stub
		return bomMapper.findQueryMaterieXQ(condition);
	}
}
